package com.perceptivesoftware.security;

import java.util.ArrayList;
import java.util.List;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

public class PerceptiveUserDetails implements UserDetails
{
	private String username;
	private String password;

	public PerceptiveUserDetails(String username)
	{
		setUsername(username);
	}

	public PerceptiveUserDetails(String username, String password)
	{
		setUsername(username);
		setPassword(password);
	}

	@Override
	public List<GrantedAuthority> getAuthorities()
	{
		final List<GrantedAuthority> gas = new ArrayList<GrantedAuthority>();
		gas.add(new SimpleGrantedAuthority("ROLE_USER"));
		return gas;
	}

	@Override
	public String getPassword()
	{
		return password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	@Override
	public String getUsername()
	{
		return username;
	}

	@Override
	public boolean isAccountNonExpired()
	{
		return true;
	}

	@Override
	public boolean isAccountNonLocked()
	{
		return true;
	}

	@Override
	public boolean isCredentialsNonExpired()
	{
		return true;
	}

	@Override
	public boolean isEnabled()
	{
		return true;
	}

	public void setUsername(String username)
	{
		this.username = username;
	}

}
